package com.example.myapplication

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button
import android.widget.TextView
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.ToastUtils

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        Log.e("test", "Main onCreate")

        findViewById<Button>(R.id.btn_open).setOnClickListener {
            startActivity(Intent(this, OnePixelActivity::class.java))
        }
        findViewById<Button>(R.id.btn_close).setOnClickListener {
            ActivityUtils.finishActivity(OnePixelActivity::class.java)
        }
        findViewById<Button>(R.id.btn_show_toast).setOnClickListener {
            LogUtils.e("点击了第一个页面的按钮")
        }
    }

    override fun onStart() {
        super.onStart()
        Log.e("test", "Main onStart")
    }

    override fun onResume() {
        super.onResume()
        Log.e("test", "Main onResume")
    }

    override fun onPause() {
        super.onPause()
        Log.e("test", "Main onPause")

    }

    override fun onStop() {
        super.onStop()
        Log.e("test", "Main onStop")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.e("test", "Main onDestroy")
    }
}